Revert "Stop copying zend_module_entry (#8551)" - #9648
Closed
arnaud-lb wants to merge 1 commit into
Closed
Conversation
This reverts commit b63df3c.
Member
|
An alternative might be to catch double-loading of modules: ext/standard/dl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index aae0996384..b8d1cbc78c 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -205,6 +205,10 @@ PHPAPI int php_load_extension(const char *filename, int type, int start_now)
return FAILURE;
}
module_entry = get_module();
+ if (zend_hash_str_exists(&module_registry, module_entry->name, strlen(module_entry->name))) {
+ zend_error(E_CORE_WARNING, "Module \"%s\" is already loaded", module_entry->name);
+ return FAILURE;
+ }
if (module_entry->zend_api != ZEND_MODULE_API_NO) {
php_error_docref(NULL, error_type,
"%s: Unable to initialize module\n" |
Contributor
|
I think detecting the double-load makes sense, even if we choose to revert this change for PHP 8. |
Member
Author
|
@cmb69 do you want to pursue the double-load catching before RC4 ? |
Member
|
@arnaud-lb, sure, I can do that. Will provide a PR shortly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reverts commit b63df3c.
Fixes #9589
After all, copying the module entry was useful. This at least prevents overriding the module entry in case the module is loaded again in
php-src/ext/standard/dl.c
Lines 228 to 230 in ed0f1f0